1421C - Palindromifier - CodeForces Solution


constructive algorithms strings *1400

Please click on ads to support us..

Python Code:

s = input()
print(3)
print("L", 2)
print("R", 2)
print("R", 2*len(s)-1)

C++ Code:

#include<iostream>
#include<cmath>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#define AboNasser cin.tie(nullptr); ios::sync_with_stdio(false);
using namespace std;
#define ll long long
typedef pair<int, int> pr;
typedef vector<ll> vll;
ll mod = 998244353;



void solve()
{
    ll n;
    //cin >> n;
    string s;
    cin >> s;
    n = s.size();
    cin >> s;
    cout << 4 << endl;
    cout << 'R' << ' ' << 2 << endl;
    cout << 'L' << ' ' << 2 << endl;
    cout << 'R' << ' ' << 2 << endl;
    cout << 'R' << ' ' << 4*n-5 << endl;

}




int main()
{
    AboNasser
        //	freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);

        ll t;
    //cin >> t;
    //while (t--)
        solve();
    return 0;

}
/*
abac    4n-2-2+1
abacab
babacab
babacabacaba
babacabacabab

ba
4n-2-2
*/


Comments

Submit
0 Comments
More Questions

Zoos
Build a graph
Almost correct bracket sequence
Count of integers
Differences of the permutations
Doctor's Secret
Back to School
I am Easy
Teddy and Tweety
Partitioning binary strings
Special sets
Smallest chosen word
Going to office
Color the boxes
Missing numbers
Maximum sum
13 Reasons Why
Friend's Relationship
Health of a person
Divisibility
A. Movement
Numbers in a matrix
Sequences
Split houses
Divisible
Three primes
Coprimes
Cost of balloons
One String No Trouble
Help Jarvis!